<?php
if(isset($_SESSION['roles']) && isset($_SESSION['sess_login_username'])){
    if( ($_SESSION['sess_login_username']!='') && ($_SESSION['roles']!='')){

    }
    else
        header('Location: index.php');

}
else
        header('Location: index.php');
require('./roots.php');

require_once('./classes/rbac.php');

include('languaje/'.$_SESSION['lang'].'/lang_'.$_SESSION['lang'].'_rbac.php');

include "header.php";

$action='FuncionCrearAsignacion.php';

$msj = '';

if(isset($_GET['result'])){
    $message=$_GET['result'];
    if($message==NULL)
        $Message=$LDCrearPermError;
    if($message==FALSE)
        $Message=$LDNoPermiso;
    if($message==TRUE)
        $Message=$LDCrearPerm;
    
    
}

$rbac= new rbac();

$role=$rbac->Buscar_rol(NULL,$_SESSION['sess_login_username']);
$user=$rbac->Buscar_usuario(NULL,$_SESSION['sess_login_username']);

?>


 <form method="post" action="<?php echo $action; ?>" name="regform" ENCTYPE="multipart/form-data" onSubmit="return chkform(this)"> 


	<div id="page">
	<div id="page-bgtop">
	<div id="page-bgbtm">
		<div id="content">
			<div class="post">
			<div class="post-bgtop">
			<div class="post-bgbtm">
				<h2 class="title"><a href="#"><?php echo $LDCrerAsig; ?></a></h2>
					
				<div class="entry">
					<p>
                                        <?php echo $Message; ?>
					<h2 class="title">
						<table width=100% border=0>
							<tr>
								<td width=50%>
									<a href="#"><?php echo $LDUsuario; ?></a>
								</td>
								<td width=50%>
									<a href="#"><?php echo $LDRol; ?></a>
								</td>
                                                                
							</tr>
						</table>
					</h2>
	       				<?php if($user!=NULL || $role!=NULL){?>
					<div class="table">
                                                <table width=100% border=0>
							<tr>
								<td width=50%>
                                                                                <select name="user">
								<?php 
								foreach($user as $array=>$user){
								?>
										<option value="<?php echo $user['login']; ?>"><?php echo $user['login']; ?></option>
                                                                <?php }?>
                                                                                </select>
								</td> 
								<td width=50%>
										<select name="role">
								<?php 
								foreach($role as $array=>$role){
								?>
										<option value="<?php echo $role['name']; ?>"><?php echo $role['name']; ?></option>
                                                                <?php }?>
                                                                                </select>
                                                                </td>
                                                                
							</tr>
						</table>
					</div>
                                            
                                            
                                        
                                            <div id="botones">
                                                <h1><a onclick="document.forms[0].submit()"><?php echo $LDAsignar; ?></a></h1>
                                            </div>
					</p>
                                           <?php }else{ echo "<BR>".$LDNoPermiso;} ?>
				</div>
			</div>
			</div>
			</div>
			
		<div style="clear: both;">&nbsp;</div>
		</div>

		<div id="sidebar">
				<ul>
					<li>
						<h2><?php echo $LDCategorias; ?></h2>

						<?php

						include "MenuRbac.php";

						?>
						<script type="text/javascript">

						cssdropdown.startchrome("chromemenu")

						</script>
				</li>
			</ul>
		</div>

		<div style="clear: both;">&nbsp;</div>
	</div>
	</div>
	</div>
</div>

</form>

<?php

include "footer.php";

?>

